﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 <link rel="stylesheet" href="style.css" type="text/css" media="all" />
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery.XYTipsWindow.min.2.8.js"></script> 
<script type="text/javascript" src="showInfo.js"> </script>
<script type="text/javascript">
function settxt(myobj){
	var IsSelected=$(myobj).attr("checked");

	$addvalue=myobj.value;
	
	$addcontent=myobj.nextSibling.nodeValue;
	$ydata=$("#mycontent").val();
	$yvalue=$("#myvalue").val();
	
	if(!IsSelected){
		if($ydata.indexOf($addcontent+",")>=0){
			$yvalue=$yvalue.replace($addvalue+",","");
			$("#myvalue").val($yvalue);

			$ydata=$ydata.replace($addcontent+",","");
			$("#mycontent").val($ydata);

		}else if($ydata.indexOf(","+$addcontent)>=0){
			$yvalue=$yvalue.replace(","+$addvalue,"");
			$("#myvalue").val($yvalue);

			$ydata=$ydata.replace(","+$addcontent,"");
			$("#mycontent").val($ydata);
		}
		else if($ydata.indexOf($addcontent)>=0){
			$yvalue=$yvalue.replace($addvalue,"");
			$("#myvalue").val($yvalue);

			$ydata=$ydata.replace($addcontent,"");
			$("#mycontent").val($ydata);		
		}	
		}
	else{
		if($ydata==""){
			$("#mycontent").val($addcontent);
			$("#myvalue").val($addvalue);
			
		}
		else
		{
			$data=$ydata+","+$addcontent;
			$value=$yvalue+","+$addvalue;
			$("#mycontent").val($data);
			$("#myvalue").val($value);
			}
		}
}
</script>
</head>
<body>
<input id="idmy" type="hidden" value="1">
<input type="text" id="mycontent">

<input type="hidden" id="myvalue">
<button  id="showDialog">点击测试</button>
<div id="testID" style="display:none ">
<label><input type="checkbox"  onclick="settxt(this)" value="11"/>ff1</label>
<label><input type="checkbox"  onclick="settxt(this)" value="12"/>ff2</label>
<label><input type="checkbox"  onclick="settxt(this)" value="13"/>ff3</label>
<label><input type="checkbox"  onclick="settxt(this)" value="14"/>ff4</label>
</div>
</body>
</html>